package cn.e4j.modular.api.controller;

import cn.digiwin.wx.utils.WeixinHandler;
import cn.e4j.core.dto.Dtos;
import cn.e4j.core.dto.impl.Dto;
import cn.e4j.core.dto.requestDtoResolver.DtoParam;
import cn.e4j.core.dto.requestDtoResolver.DtoWapper;
import cn.e4j.core.reqres.response.ResponseData;
import cn.e4j.core.util.ToolUtil;
import cn.e4j.modular.api.service.WttdService;
import cn.e4j.modular.api.util.ControllerSupport;
import cn.e4j.modular.system.service.impl.SystemServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 *  app.min.js请求的固定接口
 * @author caijy
 * @description
 * @datetime 2019-9-11 0011 17:10
 * @return
 */
@RestController
@RequestMapping("api/wttd")
public class WttdController extends ControllerSupport {

    @Autowired
    SystemServiceImpl systemService;

    @Autowired
    private WttdService wttdService;

    //获取登陆用户服务的客户
    @PostMapping(value = "getEsaaData")
    public ResponseData getEsaaData(@DtoParam DtoWapper wapper){
        Dto indto = wapper.getDto();
        List<Dto> result = wttdService.getEsaaData(indto);
        return SUCCESS(result);
    }

    //获取产品线
    @PostMapping(value = "getCpxData")
    public ResponseData getCpxData(@DtoParam DtoWapper wapper){
        Dto indto = wapper.getDto();
        List<Dto> result = wttdService.getCpxData(indto);
        return SUCCESS(result);
    }

    @RequestMapping(value = "addData")
    public ResponseData addData(@DtoParam DtoWapper wapper) {
        Dto inDto = wapper.getDto();
        wttdService.addData(wapper.getSysUser(),inDto);
        return SUCCESS;
    }

}
